Methods for protecting data stored in a memory such as a NAND flash memory (hereinafter referred to as a NAND memory) include a method for storing, in a memory, a code word generated by encoding data with an error-correcting code. Moreover, in some cases, one code word is duplicated to store the duplicated code words in a plurality of places in the memory, and accordingly the improvement of error correction capability is promoted.